from src import configNode_main as configNode
from src import Interlock_main as interlock
from src import _biaoding,buchang 
from src import Node,Master,Wrpc
if __name__ == "__main__":
    # configNode()
    # print(Node.impWavePatternTable().walk_impWaveTableMC0("192.168.1.70"))
    ip ="192.168.1."+ str(input("请输入ip:"))
    # Node.impCtrlApply().set_impCtrlApply(ip=ip,value=1)
    
    # impBPSConfig = Node.impBPSConfig()
    # impBPSConfig.set_impCtrlDeviceNum(ip=ip,value=1235)
    # impBPSConfig.set_impCtrlHeartGroup(ip=ip,value=1)
    # impBPSConfig.set_impCtrlHeartCycle(ip=ip,value=1)
    # impBPSConfig.set_impCtrlHeartOffset(ip=ip,value=0)
    # impBPSConfig.set_impCtrlCarrier(ip=ip,value=1)

    # Node.impCtrlApply().set_impCtrlApply(ip=ip,value=15)
    # impBPSConfig_data = impBPSConfig.walk_impBPSConfig(ip=ip)
    # print(impBPSConfig_data)

    # Node.impCtrlMENA().set_impCtrlMC0Ena(ip=ip,value=1)
    # Node.impCtrlMENA().set_impCtrlMC1Ena(ip=ip,value=1)
    # Node.impCtrlMENA().set_impCtrlUtcCodingEna(ip=ip,value=1)
    # Node.impCtrlMENA().set_impCtrlInterlockEna(ip=ip,value=1)
    # Node.impCtrlMENA().set_impCtrlHeartbeatEna(ip=ip,value=1)


    # Node.impCtrlApply().set_impCtrlApply(ip=ip,value=11)

    # print(Node.impCtrlMENA().walk_impCtrlMENA(ip=ip))
    print(Node.impInterlockReadGroup().walk_impInterlockReadGroup(ip=ip))

    # impWavePatternSetGroup = Node.impWavePatternSetGroup()
    # impWavePatternSetGroup.set_impWavePatternIndex(ip,0)
    # impWavePatternSetGroup.set_impWavePatternMC(ip,0)
    # impWavePatternSetGroup.set_impWavePatternDelay(ip,0)
    # impWavePatternSetGroup.set_impWavePatternWidth(ip,2500000)
    # impWavePatternSetGroup.set_impWavePatternIdle4ns(ip,22500000)
    # impWavePatternSetGroup.set_impWavePatternIdle100ms(ip,9)
    # impWavePatternSetGroup.set_impWavePatternSet(ip,1)
    # Node.impCtrlApply().set_impCtrlApply(ip,3)
    # # print("修改MC0输出参数为PPS")

    # print(Node.impInterlockReadGroup().walk_impInterlockReadGroup(ip=ip))
    impWaveTableMC0_data = list(Node.impWavePatternTable().walk_impWaveTableMC0(ip=ip).values())
    print(impWaveTableMC0_data[0],impWaveTableMC0_data[16],impWaveTableMC0_data[32],impWaveTableMC0_data[48])

    # Node.impCtrlApply().set_impCtrlApply(ip=ip,value=3)

    # print(Wrpc.wrpcSfpTable().walk_wrpcSfpTable(ip=ip))
    # buchang(ip)
    
    # flag = int(input("是否需要标定"))
    # if flag == 1:
    #     _biaoding(ip)
    # else:
    #     buchang(ip)
    # interlock("192.168.1.23",10)
    # print(Master.impInterlockReadGroup().walk_impInterlockReadGroup("192.168.1.160"))
    # print(Master.impInterlockReadGroup().walk_impInterlockReadGroup("192.168.1.161"))
    pass
